/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Administracion;

import javax.swing.JDesktopPane;

/**
 *
 * @author pato
 */
public class Principal extends javax.swing.JFrame {
public int usuario;
static JDesktopPane estatico;
    /**
     * Creates new form Principal
     */
    public Principal() {
        initComponents();
        estatico = jDesktopPane1;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuItem1 = new javax.swing.JMenuItem();
        jDesktopPane1 = new javax.swing.JDesktopPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        corte = new javax.swing.JMenu();
        Clientes = new javax.swing.JMenu();
        jMenu1 = new javax.swing.JMenu();
        Propiedades = new javax.swing.JMenu();
        cambiar = new javax.swing.JMenu();
        pedido = new javax.swing.JMenu();

        jMenuItem1.setText("jMenuItem1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        corte.setText("Corte por Dia");
        corte.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                corteMouseClicked(evt);
            }
        });
        jMenuBar1.add(corte);

        Clientes.setText("Clientes");
        Clientes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ClientesMouseClicked(evt);
            }
        });
        jMenuBar1.add(Clientes);

        jMenu1.setText("Sucursales");
        jMenu1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu1MouseClicked(evt);
            }
        });
        jMenuBar1.add(jMenu1);

        Propiedades.setText("Propiedades");

        cambiar.setText("Cambiar Conexion");
        cambiar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                cambiarMouseClicked(evt);
            }
        });
        Propiedades.add(cambiar);

        jMenuBar1.add(Propiedades);

        pedido.setText("Pedidos");
        pedido.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                pedidoMouseClicked(evt);
            }
        });
        jMenuBar1.add(pedido);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 475, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 336, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void corteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_corteMouseClicked
ventasdia v = new ventasdia();
        // se añade al jDesktopPane
        jDesktopPane1.add(v);
        //se muestra en pantalla
        v.show();
        // TODO add your handling code here:
    }//GEN-LAST:event_corteMouseClicked

    private void ClientesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ClientesMouseClicked
Clientes c = new Clientes();
jDesktopPane1.add(c);
c.show();
        // TODO add your handling code here:
    }//GEN-LAST:event_ClientesMouseClicked

    private void cambiarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cambiarMouseClicked
(new cambiarConexion(this,true)).setVisible(true);
        // TODO add your handling code here:
    }//GEN-LAST:event_cambiarMouseClicked

    private void jMenu1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu1MouseClicked
        Sucursales sucursal = new Sucursales();
        sucursal.setVisible(true);
        
        jDesktopPane1.add(sucursal);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenu1MouseClicked

    private void pedidoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_pedidoMouseClicked
        Pedidos pedido = new Pedidos();
        pedido.setVisible(true);
        
        jDesktopPane1.add(pedido);
        
        // TODO add your handling code here:
    }//GEN-LAST:event_pedidoMouseClicked

    /**
     * @param args the command line arguments
     */
   public void setUsuario(int user){
       usuario = user;
}
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu Clientes;
    private javax.swing.JMenu Propiedades;
    private javax.swing.JMenu cambiar;
    private javax.swing.JMenu corte;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenu pedido;
    // End of variables declaration//GEN-END:variables
}
